﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            var uid = txtUsername.Text.Trim();
            var pwd = txtPassword.Text.Trim();

            var sql = string.Format("select * from users where Username='{0}' and Password='{1}'", uid,pwd);
            var dt = DbHelper.GetData(sql);
            if (dt.Rows.Count==1)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                lblComment.Text = "错误";
            }
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {

        }
    }
}